1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| 1.移除旧版本 sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-selinux \ docker-engine-selinux \ docker-engine 2.系统工具 sudo yum install -y yum-utils device-mapper-persistent-data lvm2 3.添加软件源信息 sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo 4.更新yum命令 centos7:sudo yum makecache fast centos8:sudo yum makecache 5.安装docker sudo yum -y install docker-ce //最新 sudo yum install -y docker-ce-18.09.7 docker-ce-cli-18.09.7 containerd.io 指定 6.启动docker后台 sudo systemctl start docker // 设置开机自启 sudo systemctl enable docker 其他: sudo systemctl stop docker // 停止 sudo systemctl restart docker // 重启 sudo systemctl status docker // 查看状态 sudo systemctl enable docker // 设置开机自启 sudo systemctl disable docker // 取消开机自启 sudo systemctl is-enabled docker // 查看是否已经配置开机自启 docker -v //查看版本
|